<!DOCTYPE html>
<html>
	<head>
		<title>Color Editor</title>
		<link rel="stylesheet" href="../../../codebase/webix.css" type="text/css" charset="utf-8">
		<script src="../../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../common/samples.css">
	</head>
	<body>
		<div class='sample_comment'> Colorpicker:</div>
		<div id="testA"></div>
		<hr>

		<div class='sample_comment'> Colorpicker with templates:</div>
		<div id="testB"></div>
		<hr>		


		<script type="text/javascript" charset="utf-8">

		webix.ready(function(){
			grida = webix.ui({
				container:"testA",
				view:"datatable",
				columns:[
					{ id:"id",							header:"", css:"rank",  		width:50},
					{ id:"title",	editor:"text",		header:"Film title",width:200},
					{ id:"start",	editor:"color",		header:"Color A",	width:120},
					{ id:"end",		editor:"color",		header:"Color B", 	width:120}
				],
				
				editable:true,
				autoheight:true,
				autowidth:true,

				data: [
					{ id:1, title:"The Shawshank Redemption", start:"#FF00FF", end:"#00FF00" },
					{ id:2, title:"The Godfather", start:"", end:"" }
				]
			});
		
		


			var tpl = function(value){
				return "<span style='background-color:"+value+"; border-radius:4px; padding-right:10px;'>&nbsp&nbsp</span> "+value;
			}
			
			grida = webix.ui({
				container:"testB",
				view:"datatable",
				columns:[
					{ id:"id",							header:"", css:"rank",  		width:50},
					{ id:"title",	editor:"text",		header:"Film title",width:200},
					{ id:"start",	editor:"color",	 	header:"Color A",	width:120, 
						template:function(obj){ return tpl(obj.start); }
					},
					{ id:"end",		editor:"color",		header:"Color B", 	width:120,
						template:function(obj){ return tpl(obj.end); }
					}
				],
				
				editable:true,
				autoheight:true,
				autowidth:true,

				data: [
					{ id:1, title:"The Shawshank Redemption", start:"#FF00FF", end:"#00FF00" },
					{ id:2, title:"The Godfather", start:"", end:"" }
				]
			});
		
		});

		</script>
	</body>
</html>